package com.cat.dataStructure;

import java.io.*;

/**
 * @author 曲大人的喵
 * @description https://www.luogu.com.cn/problem/P3374
 * @create 2025/9/28 12:09
 * @since JDK17
 */

public class Solution87 {
    static int N = ((int) (5e5 + 2)), n, m;
    static long[] tree = new long[N];
    // 输入
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    // 帮助类
    static StreamTokenizer in = new StreamTokenizer(br);
    // 输出
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static void add(int i, int val) {
        for (; i <= n; i += i & -i) {   // 最右侧的1
            tree[i] += val;
        }
    }
    static long sum(int i) {
        long ans = 0;
        for (; i > 0; i -= -i & i) {
            ans += tree[i];
        }
        return ans;
    }

    public static void main(String[] args) throws IOException {
        in.nextToken();
        n = ((int) in.nval);
        in.nextToken();
        m = ((int) in.nval);
        for (int i = 1; i <= n; i++) {
            in.nextToken();
            int num = ((int) in.nval);
            add(i, num);
        }
        for (int i = 0; i < m; i++) {
            in.nextToken();
            int opt = ((int) in.nval), n1, n2;
            in.nextToken();
            n1 = ((int) in.nval);
            in.nextToken();
            n2 = ((int) in.nval);
            if (opt == 1) { // 加操作
                add(n1, n2);
            } else {    // 查询
                out.println(sum(n2) - sum(n1 - 1));
            }
        }
        out.flush();
        out.close();
        br.close();
    }
}
